package com.ureport2.ureportConsole;

import com.bstek.ureport.definition.datasource.BuildinDatasource;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

@Configuration
public class TestBuildinDatasource implements BuildinDatasource {

    private DataSource dataSource;
    public String name(){
        return "test";
    }

    public Connection getConnection(){
        try {

            return dataSource.getConnection();
        }catch (SQLException e){
            throw new RuntimeException(e);
        }
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

}
